<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <button onclick="get()">GET</button>
    <button onclick="post()">POST</button>
    <script src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js"></script>
    <script>
        function get(){
            $.ajax({
                type: "get",
                url: "HttpServletRequest",
                success: function(data,status){
                    console.log(data);
                }
            })
        }
        function post(){
            let body = {
                userId: 100,
                userName: 1
            }
            $.ajax({
                type: "post",
                url: "PostParameter",
                //url: "HttpServletRequest",
                //contentType:"application/x-www-form-urlencoded;charset=utf-8",
                contentType:"application/json;charset=utf-8",
                data:JSON.stringify(body),
                success: function(data,status){
                    console.log(data);
                }
            })
        }
    </script>
</body>
</html>